<template>
    <el-dialog
            title="工作流信息"
            :visible.sync="dragInfoVisible"
            :close-on-click-modal="false"
            width="40%"
            v-dialogDrag>
        <div style="padding-left: 0.5%;padding-top:1%">
            <p>工作流ID：{{this.infoData.id}}</p>
            <p>工作流名称：{{this.infoData.name}}</p>
            <p>工作流描述：{{this.infoData.description}}</p>
            <p>用户id：{{this.infoData.userid}}</p>
            <p>连接信息：{{this.infoData.connections}}</p>
            <p>节点信息：{{this.infoData.nodes}}</p>
            <p>创建时间：{{this.infoData.createdtime}}</p>
            <p>最后修改时间：{{this.infoData.lastmodifytime}}</p>
        </div>
    </el-dialog>
</template>

<script>
    export default {
        data() {
            return {
                dragInfoVisible: false,
                url: '',
                infoData: {},
            }
        },
        methods: {
            getModelInfo() {
                let that = this;
                this.infoData = {};
                this.$axios.get(that.url).then(res => {
                    that.infoData = res.body;
                }).catch(function (error) {
                    console.log(error);
                    that.$message({
                        type: 'warning',
                        message: '模型信息获取失败！'
                    })
                })
            }
        },
        created() {
            let that = this;
            this.$Bus.$on('dragInfo', res => {
                that.url = "http://192.168.1.5:9500/dbfg/workflow/dags/"+res;
                that.dragInfoVisible = true;
                that.getModelInfo();
            })
        }
    }

</script>

<style>
    .el-dialog__body {
        max-height: 600px;
        overflow: auto;
    }
</style>